import NotFount from "@/pages/admin/notFount";
import MaterialList from "@/pages/admin/project/resourceManage/materialList";
import UserList from "@/pages/admin/project/userManage/userList";
import BlockEdit from "@/pages/admin/test/blockEdit";
import BoneView from "@/pages/admin/test/boneView";
import CodeEditor1 from "@/pages/admin/test/codeEditor1";
import DataView from "@/pages/admin/test/dataView";
import DrawBoard from "@/pages/admin/test/drawBoard";
import DrawBoard1 from "@/pages/admin/test/drawBoard1";
import Flow from "@/pages/admin/test/flow";
import Flow1 from "@/pages/admin/test/flow1";
import FrameMotion from "@/pages/admin/test/frameMotion";
import MimicryDesign from "@/pages/admin/test/mimicryDesign";
import SwiperDemo from "@/pages/admin/test/swiperDemo";
import Tmp from "@/pages/admin/test/tmp";
import ViewEdit from "@/pages/admin/test/viewEdit";
import React from "react";
import {BiData} from "react-icons/bi";
import {FcFrame, FcTemplate} from "react-icons/fc";
import {GoWorkflow} from "react-icons/go";
import {GrCode, GrDashboard, GrFormEdit, GrList, GrResources, GrUser} from "react-icons/gr";
import {HiMiniInboxStack} from "react-icons/hi2";
import {LiaBoneSolid} from "react-icons/lia";
import {MdDraw, MdMovieEdit} from "react-icons/md";
import {SiSwiper} from "react-icons/si";
import {RouteObject} from "react-router-dom";
import Dashboard from "../pages/admin/project/dashboard";


export type NavRouterObject = RouteObject & {
    label: string
    children?: NavRouterObject[]
    icon?: React.ReactNode
    key: string
    isDefault?: boolean
    hidden?: boolean
}

export const projectRoutes: NavRouterObject[] = [
    {
        label: "仪表盘",
        key: "dashboard",
        icon: <GrDashboard/>,
        path: "dashboard",
        element: <Dashboard/>,
        isDefault: true,
    },
    {
        label: "资源管理",
        key: "resourceManage",
        icon: <GrResources/>,
        path: "resourceManage",
        children: [
            {
                label: "素材管理",
                key: "materialList",
                path: "materialList",
                icon: <HiMiniInboxStack/>,
                element: <MaterialList/>
            }
        ]
    },
    {
        label: "用户管理",
        key: "drawBoard",
        path: "/admin/projectCenter/userManage",
        icon: <GrUser/>,
        children: [
            {
                label: "用户列表",
                key: "userList",
                path: "userList",
                icon: <GrList/>,
                element: <UserList/>,
            }
        ]
    },
];

export const testRoutes: NavRouterObject[] = [
    {
        label: "临时",
        key: "tmp",
        icon: <FcTemplate/>,
        path: "tmp",
        element: <Tmp/>,
    },
    {
        label: "FrameMotion",
        key: "frameMotion",
        icon: <FcFrame/>,
        path: "frameMotion",
        element: <FrameMotion/>,
        isDefault: true
    },
    {
        label: "骨架屏",
        key: "boneView",
        icon: <LiaBoneSolid/>,
        path: "boneView",
        element: <BoneView/>,
    },
    {
        label: "数据大屏-Demo1",
        key: "dataView",
        icon: <BiData/>,
        path: "dataView",
        element: <DataView/>,
    },
    {
        label: "画板-Excalidraw",
        key: "drawBoard",
        icon: <MdDraw color={"#c62f2f"}/>,
        path: "drawBoard",
        element: <DrawBoard/>,
    },
    {
        label: "画板-tldraw",
        key: "drawBoard1",
        icon: <MdDraw color={"#612fc6"}/>,
        path: "drawBoard1",
        element: <DrawBoard1/>,
    },
    {
        label: "流程图-xyflow",
        key: "flow",
        icon: <GoWorkflow/>,
        path: "flow",
        element: <Flow/>,
    },
    {
        label: "流程图1-xyflow",
        key: "flow1",
        icon: <GoWorkflow/>,
        path: "flow1",
        element: <Flow1/>,
    },
    {
        label: "块编辑器",
        key: "blockEdit",
        icon: <GrFormEdit/>,
        path: "blockEdit",
        element: <BlockEdit/>,
    },
    {
        label: "可视化编辑器",
        key: "viewEdit",
        icon: <MdMovieEdit/>,
        path: "viewEdit",
        element: <ViewEdit/>,
    },
    {
        label: "轮播图-Swiper",
        key: "swiperDemo",
        icon: <SiSwiper/>,
        path: "swiperDemo",
        element: <SwiperDemo/>,
    },
    {
        label: "代码编辑器",
        key: "codeEditor1",
        icon: <GrCode/>,
        path: "codeEditor1",
        element: <CodeEditor1/>,
    },
    {
        label: "拟态风",
        key: "mimicryDesign",
        icon: <SiSwiper/>,
        path: "mimicryDesign",
        element: <MimicryDesign/>,
        hidden:true
    },
]

export const adminRoutes: NavRouterObject[] = [
    {
        key: "projectCenter",
        label: "项目中心",
        path: "/admin/projectCenter",
        children: projectRoutes
    },

    {
        key: "test",
        label: "测试",
        path: "/admin/test",
        children: testRoutes
    },


    {
        key: "404",
        label: "",
        path: "*",
        element: <NotFount/>
    }
];

export const getDefaultNav = (routes: NavRouterObject[]) => {
    const defaultRoutes = routes.filter(item => item.isDefault)
    return defaultRoutes.length > 0 ? defaultRoutes[0] : routes[0];
}

